DateInfo: Fix timeToStringWithFormat buffer length
authorErich E. Hoover <erich.e.hoover@gmail.com>
Thu, 2 Jul 2026 16:52:33 +0000 (16:52 +0000)
committerJohn Scott <jscott@posteo.net>
Thu, 2 Jul 2026 16:52:33 +0000 (16:52 +0000)
commit49184b87c21fc0205cfdd2aa6d15b464aa678afd
tree0119055af67aa8bf3aa0a790006aef40b306d51e
parente93e958d244729c300e5132fe9d5107e5668b1f8
DateInfo: Fix timeToStringWithFormat buffer length

Origin: upstream, https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1824.patch
Applied-Upstream: 25.06.0, https://gitlab.freedesktop.org/poppler/poppler/-/commit/55169105e121d5fbb7c50e2c744d750de5d0a7de
Bug: https://gitlab.freedesktop.org/poppler/poppler/-/work_items/1596
Bug-Debian: https://bugs.debian.org/1127146
Reviewed-By: John Scott <jscott@posteo.net>
Last-Update: 2026-07-01

strftime places a NULL-terminated string in the buffer, so the std::string
buffer needs to be resized to not include the terminator character
(or anything after it).

Without this fix, modification dates in altered PDF documents (such as when
adding a digital signature) are not truncated properly, instead padding
the date with a null byte and extra spaces until the end of the buffer is
reached. This bad syntax compromises the ability to verify the signature
with other applications, but the Poppler signatory has no indication of this.

Gbp-Pq: Name malformed-moddate.patch
poppler/DateInfo.cc